﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompanyRatings.SQL.PerfTest.ConsoleApp.Repositories
{
    public class WeightMatrix
    {
        public Guid Id { get; set; }
        public string Name { get; set; }

        public static WeightMatrix FromDataRow(DataRow row)
        {
            WeightMatrix data = new WeightMatrix();
            data.Id = (Guid)row["Id"];
            data.Name = (string)row["Name"];

            return data;
        }

        public static List<WeightMatrix> FromDataTable(DataTable table)
        {
            List<WeightMatrix> lst = new List<WeightMatrix>();

            if (table != null && table.Rows.Count > 0)
            {
                foreach (DataRow row in table.Rows)
                {
                    WeightMatrix data = FromDataRow(row);
                    lst.Add(data);
                }
            }

            return lst;
        }
    }
}
